package com.heima.wemedia.controller.v1;

import com.heima.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmCommentApplyDto;
import com.heima.model.wemedia.dtos.WmCommentPageReqDto;
import com.heima.model.wemedia.dtos.WmCommentStatusDto;
import com.heima.wemedia.service.WmCommentService;
import javafx.geometry.Pos;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: Xu
 * @Date: 2022/01/03/15:02
 */
@RestController
@RequestMapping("/api/v1/comment/manage")
public class WmCommentController {
    @Autowired
    private WmCommentService wmCommentService;
    /**
     * 查看评论列表
     * @return
     */
    @PostMapping("/find_news_comments")
    public ResponseResult findNewsComment(@RequestBody WmCommentApplyDto dto){
//        return  wmCommentService.findNewsComment(dto);
        return  wmCommentService.findNewsCommentList(dto);


    }
    /**
     * 更改评论装填
     */
    @PostMapping("/update_comment_status")
    public  ResponseResult updateCommentStatus( @RequestBody WmCommentStatusDto dto){
       return wmCommentService.updateCommentStatus(dto);

    }
    /**
     * 查看单条文章的评论列表
     */
        @PostMapping("/list")
       public ResponseResult findCommentList(@RequestBody WmCommentPageReqDto dto){
              return   wmCommentService.findCommentList(dto);
        }
    /**
     * 删除评论
      */
    @DeleteMapping("del_comment/{commentId}")
    public ResponseResult deleteComment(@PathVariable("commentId") String commentId){

        return wmCommentService.deleteComment(commentId);

    }
    /**
     * 删除评论的回复
     */
    @DeleteMapping("del_comment_repay/{commentRepayId}")
    public ResponseResult deleteCommentRepay(@PathVariable("commentRepayId") String commentRepayId){
        return wmCommentService.deleteCommentRepay(commentRepayId);
    }


}
